import React,{Component} from "react";
export class Alert extends Component {
    constructor(props){
        super(props)
        this.state={
            flag:false,
            arr:[1,2,3],
        }
    }
    render(){
        const {flag}=this.state
        return (
            <div>
                <button onClick={function(e){
                    this.setState({
                        flag:true
                    })
                }.bind(this)}>打开弹框</button>
                {
                    flag ? <div className="mask">
                        <div className="cont">
                            <span onClick={()=>{
                                this.setState({
                                    flag:false
                                })
                            }}>✘</span>
                            我是弹框内容
                        </div>
                    </div> : null       
                }
            </div>
        )
    }
}
export default Alert